import { Injectable } from '@nestjs/common';
import { SkuService } from '../sku/sku.service';
import { AddressService } from '../address/address.service';

@Injectable()
export class SettingsService {
  constructor(
    private readonly skuService: SkuService,
    private readonly addressService: AddressService,
  ) {}

  async getSettings() {
    const [skus, address] = await Promise.all([
      this.skuService.findAll(),
      this.addressService.GetDefaultAddress(),
    ]);

    return {
      skuList: skus,
      address: {
        id: address.id,
        details: address.details,
      },
    };
  }
}
